<template>
  <div >
    <h1 align="center" style="margin:50px 0 80px 0">企业回收站信息列表</h1>

  <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column
      label="企业编号"
      prop="companyCode">
    </el-table-column>
    <el-table-column
      label="企业名称"
      prop="companyName">
    </el-table-column>
    <el-table-column
      label="证件类型"
      prop="idType">
    </el-table-column>
    <el-table-column
      label="证件号码"
      prop="idNumber">
    </el-table-column>
    <el-table-column
      label="企业成立日期"
      prop="createDate">
    </el-table-column>
    <el-table-column
      label="注册资本（万元）"
      prop="registerCapital">
    </el-table-column>
   
    <el-table-column
      align="right">
     
      <template slot-scope="scope">
        <el-button
          size="mini"
          @click="handleEdit(scope.row.companyCode)">恢复</el-button>
          <el-button
          size="mini"
           type="danger"
          @click="handleDelete(scope.row.companyCode)">删除</el-button>
       
      </template>
    </el-table-column>
  </el-table>

   <div   style="margin:50px auto 50px auto ;width:fit-content">
        <el-button type="primary" @click="returnIndex">返回主页</el-button>  
    </div>
    </div>
</template>

<script>
import {recycleToShow,retractrecycle,deleterecycle} from '@/api/recycle/index'

  export default {
   
    data() {
      return {
        tableData: [],
        search: '',
        search1: ''
      }
    },
    methods: {
       returnIndex(){
         this.$router.replace('/index')
       },

      handleDelete(row) {
        console.log(row)
        deleterecycle(row).then(res=>{
          this.showRecycle(res)
        })
      },
      showRecycle(){
        recycleToShow().then(res => {
           console.log(res)
           this.tableData = res
        }).catch((e) => {console.log(e )})
      },
      handleEdit(row) {
       retractrecycle(row).then(res =>{
         this.showRecycle(res)
       })

      },
    },

    mounted(){
      this.showRecycle()
    }
  }
</script>





   
 



